
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <script src="/static/js/jquery-1.8.3.min.js"></script>
    <script src="/static/js/jquery.cookie.js"></script>

    <title> 洽里么? &nbsp;&nbsp;:-) </title>
    <style>
        .center_div{
            width: 80%;
            margin: 0 auto;
        }

        .head_small{
            width: 35px;
            height: 35px;
        }

        .center-in-center{
            position: absolute;
            top: 50%;
            left: 50%;
        }
    </style>

    <script>
        function get_light_mode() {
            if($.cookie('light_mode')){
                light_mode = $.cookie('light_mode')

            }else{
                light_mode = -1
            }
            return light_mode
        }

        function switch_light_mode() {
            light_mode = get_light_mode()

            console.log(light_mode)
            light_mode = light_mode * -1

            $.cookie('light_mode', light_mode); // 存储 cookie
            light()
        }

        function light() {
            light_mode = get_light_mode()

            if (light_mode==1){
                $('body').attr('bgcolor', '#ffffff')
            }
            if(light_mode==-1){
                $('body').attr('bgcolor', '#99ff99')
            }
        }
    </script>


    <script>
      function show_msg(msg, time) {
        $("#msg_container").html(msg).show(time).delay(time).hide(300);
      }
    </script>
    <script>
        light()
    </script>
    {% block css %}
    {% endblock %}

    {% block js %}
    {% endblock %}
  </head>

  <body onload="light()">
    <div id="msg_container" class="center-in-center" style="background-color: #f0ad4e" hidden>
    </div>

    <div class="center_div">
        <a onclick="switch_light_mode()" style="color: #f0ad4e">☀</a>
        <a href="/">大厅</a>
        <a href="/user/info">{{ z_user.username }}</a>
        <a href="/sign/in">登录</a>&nbsp;
        <a href="/sign/up">注册</a>

        <a href="/post/create">发帖</a>
        <a href="/leifeng/index">互助</a>
        <a href="/fun/index">娱乐</a>
        <a href="/others/index">其他</a>

        <a style="float: right">&nbsp;&nbsp;&nbsp;今日活跃人数:&nbsp;&nbsp;{{ activity_users_count }}</a>
        <a href="/logout" style="float: right">&nbsp;退出</a>
    </div>
    <hr>

      {% block content %}
      {% endblock %}

      <hr>
      <div class="center_div"><p>&copy; copyright&nbsp;&nbsp;z7z8.cc &nbsp;2016&nbsp;<a href="/about/index">关于本站</a></p></div>
  </body>
</html>
